package edu.njust.cma.mapper;

import edu.njust.cma.pojo.Project;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface ProjectMapper {

    @Select("select * from projects where id=#{id}")
    Project getProject(Integer id);

    @Select("select * from projects")
    List<Project> getAllProject();

    @Select("select * from projects where lab_director_id=#{userId}")
    List<Project> getAllProjectByLabDirectorId(Integer userId);

    @Update("update projects set status=#{status} where id=#{projectId}")
    void updateStatus(Integer projectId, int status);

    @Select("select * from projects where lab_director_id=#{userId}")
    List<Project> getProjectByLabHeadId(int userId);

    @Select("select * from projects where id=#{projectId}")
    Project getProjectById(Integer projectId);
}
